﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

namespace BookOnline.Data
{
    public class Books
    {
        private string _BookID;
        private string _BookName;
        private string _BookPrice;
        private string _BookImage;
        private string _BookDes;
        private string _CatID;
        private string _PubID;

        public string BookID { get { return _BookID; } set { _BookID = value; } }
        public string BookName { get { return _BookName; } set { _BookName = value; } }
        public string BookPrice { get { return _BookPrice; } set { _BookPrice = value; } }
        public string BookImage { get { return _BookImage; } set { _BookImage = value; } }
        public string BookDes { get { return _BookDes; } set { _BookDes = value; } }
        public string CatID { get { return _CatID; } set { _CatID = value; } }
        public string PubID { get { return _PubID; } set { _PubID = value; } }

        public Books BooksIDataReader(IDataReader dr)
        {
            Books obj = new Books();
            obj.BookID = (dr["BookID"] is DBNull) ? string.Empty : dr["BookID"].ToString();
            obj.BookName = (dr["BookName"] is DBNull) ? string.Empty : dr["BookName"].ToString();
            obj.BookPrice = (dr["BookPrice"] is DBNull) ? string.Empty : dr["BookPrice"].ToString();
            obj.BookImage = (dr["BookImage"] is DBNull) ? string.Empty : dr["BookImage"].ToString();
            obj.BookDes = (dr["BookDes"] is DBNull) ? string.Empty : dr["BookDes"].ToString();
            obj.CatID = (dr["CatID"] is DBNull) ? string.Empty : dr["CatID"].ToString();
            obj.PubID = (dr["PubID"] is DBNull) ? string.Empty : dr["PubID"].ToString();
            return obj;
        }
    }
}
